<!DOCTYPE html>
<html>
    <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>我的- 修改密码</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="../favicon.ico">
	<link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__PUBLIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="__PUBLIC__/css/animate.css" rel="stylesheet">
	<link href="__PUBLIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
    </head>
    <body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
	    <div class="row">
		<div class="col-sm-12">
		    <div class="ibox float-e-margins">
			<div class="ibox-title">
			    <h5>我的- <small>修改密码</small>
			    </h5>
			</div>
			<div class="ibox-content">
			    <form method="post" class="form-horizontal" onsubmit="return false">
				<div class="form-group">
				    <label class="col-sm-2 control-label">*原密码</label>
				    <div class="col-sm-10">
					<input type="password" class="form-control" placeholder="请输入原密码" id="txtpasswordold" name="txtpasswordold">
				    </div>
				</div>
				<div class="form-group">
				    <label class="col-sm-2 control-label">*新密码</label>
				    <div class="col-sm-10">
					<input type="password" class="form-control" placeholder="请输入新密码" id="txtpassword" name="txtpassword">
				    </div>
				</div>
				<div class="form-group">
				    <label class="col-sm-2 control-label">*确认密码</label>
				    <div class="col-sm-10">
					<input type="password" class="form-control" placeholder="请输入确认密码" id="txtpasswordconfirm" name="txtpasswordconfirm">
				    </div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
				    <div class="col-sm-4 col-sm-offset-2">
					<button class="btn btn-primary" type="button" onclick="password_modify_submit()">修改</button>&nbsp;&nbsp;&nbsp;
					<button class="btn btn-white" type="reset">重置</button>
				    </div>
				</div>
			    </form>
			</div>
		    </div>
		</div>
	    </div>
	</div>
	<!-- 全局js -->
	<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义js -->
	<script src="__PUBLIC__/js/content.js?v=1.0.0"></script>
	<script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script type="text/javascript">
					    var modifypasswordsubmiturl = "<{:U('modifypasswordsubmit','','shtml')}>";
					    var loginurl = "<{:U('./login','','shtml')}>";
					    function password_modify_submit() {
						//加载loading层
						var loading = layer.load(1, {
						    shade: [0.1, '#fff'] //0.1透明度的白色背景
						});
						var $txtpasswordold = $("#txtpasswordold");
						var $txtpassword = $("#txtpassword");
						var $txtpasswordconfirm = $("#txtpasswordconfirm");
						var passwordold = $txtpasswordold.val();
						var password = $txtpassword.val();
						var passwordconfirm = $txtpasswordconfirm.val();
						if (passwordold == "") {
						    layer.close(loading);
						    layer.alert("原密码不能为空！\r\n", {
							title: '提示框',
							icon: 0,
						    });
//						    $txtpasswordold.focus();
						    return false;
						}
						if (password == "") {
						    layer.close(loading);
						    layer.alert("新密码不能为空！\r\n", {
							title: '提示框',
							icon: 0,
						    });
//						    $txtpassword.focus();
						    return false;
						}
						if (passwordconfirm == "") {
						    layer.close(loading);
						    layer.alert("确认密码不能为空！\r\n", {
							title: '提示框',
							icon: 0,
						    });
//						    $txtpasswordconfirm.focus();
						    return false;
						}
						if (password != passwordconfirm) {
						    layer.close(loading);
						    layer.alert("密码与确认密码不一致！\r\n", {
							title: '提示框',
							icon: 0,
						    });
						    return false;
						}
						$.post(modifypasswordsubmiturl, {passwordold: passwordold, password: password, passwordconfirm: passwordconfirm}, function (data) {
						    if (data.ret == "1001") {
							layer.close(loading);
							layer.msg(data.code, {icon: 6, time: 1000});
							setTimeout(function () {
							    window.location.href = loginurl;
							}, 1000);
						    } else {
							layer.close(loading);
							layer.msg(data.code, {icon: 5, time: 1000});
						    }
						}, 'json');
					    }

	</script>
    </body>
</html>